package com.briup.test;

/**
 * @author 甜圆
 * @version v1.0.1
 * @date 2025/9/29 17:11
 * @package com.briup.test
 * @copyright 甜圆
 */

public class MultiThreadExample {
    public static void main(String[] args) {
        System.out.println("主线程开始: " + Thread.currentThread().getName());

        // 创建其他线程
        Thread t5 = new Thread(() -> {
            System.out.println("线程5: " + Thread.currentThread().getName());
        });        Thread t4 = new Thread(() -> {
            System.out.println("线程4: " + Thread.currentThread().getName());
        });        Thread t3 = new Thread(() -> {
            System.out.println("线程3: " + Thread.currentThread().getName());
        });        Thread t2 = new Thread(() -> {
            System.out.println("线程2: " + Thread.currentThread().getName());
        });
        Thread t1 = new Thread(() -> {
            System.out.println("线程1: " + Thread.currentThread().getName());
        });





        t5.start();
        t1.start();
        t2.start();
        t3.start();
        t4.start();

        System.out.println("主线程结束");
        // 主线程结束后，t1和t2可能还在运行
    }
}








